import { lazy } from "react";
import {Navigate} from 'react-router-dom'

const Login = lazy(()=>import('../pages/Login'))
const Home = lazy(()=>import('../pages/Home'))
const Layout = lazy(()=>import('../pages/Layout'))
const My = lazy(()=>import('../pages/My'))
const Hot = lazy(()=>import('../pages/Hot'))
const City = lazy(()=>import('../pages/city'))
const One = lazy(()=>import('../pages/One'))
const Two = lazy(()=>import('../pages/Two'))
const Three = lazy(()=>import('../pages/Three'))


export const tabberRouter=[
    {
        path:'/home',
        meta:{title:'首页'},
        element:<Home/>
    },
    {
        path:'/my',
        meta:{title:'我的'},
        
        element:<My/>
    },
    {
        path:'/one',
        meta:{title:'社区'},
        
        element:<One/>
    },
    {
        path:'/two',
        meta:{title:'消息'},
        
        element:<Two/>
    },
    {
        path:'/three',
        meta:{title:'行程'},
        
        element:<Three/>
    }
]

const router=[
    {
        path:'/login',
        element:<Login/>
    },
    {
        path:'/hot',
        element:<Hot/>
    },
    {
        path:'/',
        element:<Layout/>,
        children:[
            ...tabberRouter,
            {
                path:'/',
                element:<Navigate to='/home'/>
            }
        ]
    },
    {
        path:'/city',
        element:<City/>
    }
]
export default router